#include <stdio.h>
#include <stdlib.h>

#define SIZE 3

struct Student_type {
    char name[10];
    int num;
    int age;
    char addr[15];
} stud[SIZE];

int main() {
    int i;
    FILE *pt;
    if ((pt = fopen("D:\\C\\stu.txt", "r")) == NULL) {
        printf("cannot open file!\n");
        exit(0);
    }
    for (i = 0; i < SIZE; i++) {
        fread(&stud[i], sizeof(struct Student_type), 1, pt);
        printf("%-10s %4d %4d  %-15s\n", stud[i].name, stud[i].num, stud[i].age, stud[i].addr);
    }
    fclose(pt);
    return 0;
}
